/**
 * 网站统计
 * @type type
 * @author 王荣
 * @version 2018.5.15
 */
;var webStatistic = {
    
    statistic_url: null,
    url: null,
    prev_url: null,
    
    init: function(){
        var _self = this;
        this.url = window.location.href;
        
		_self.store();
        _self.hack_history();
        _self.pushState();
    },
        
    hack_history: function(){
        (function(history){
            var pushState = history.pushState;
            history.pushState = function(state) {
                if (typeof history.onpushstate == "function") {
                    history.onpushstate({state: state});
                }
                // ... whatever else you want to do
                // maybe call onhashchange e.handler
                return pushState.apply(history, arguments);
            };
        })(window.history);
    },
    
    pushState: function(){
        var _self = this;
        history.onpushstate = function(e) {
            setTimeout(function(){
                _self.url = window.location.href;
                _self.store();
            },10);
        }
    },
    
    store: function(){
        var _self = this;
        $.post('/WebStatistic/store', {url: _self.url});
    },
        
};


